package cn.cycleif.job;

import cn.cycleif.app.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Date: 25/2/11-17:14
 * @Desc:
 */
@Component
@Slf4j
public class HyperLogTask {

  @Autowired
  private RedisService redisService;

  @Scheduled(cron = "0 30 23 * * ?")
  @Transactional(rollbackFor = Exception.class)
  public void createHyperLog() {
    log.info("计数落库开始");
    redisService.syncQuestionViewCount();
    log.info("计数落库结束");
    log.info("点赞落库开始");
    redisService.syncVote();
    log.info("点赞落库结束");
  }
}
